package com.haocean.project.model.dto;

public enum DeviceType {

    WATER(1, "水质设备"),
    AIR(2, "空气设备"),
    NOISE(3, "噪音设备");

    private final int code;

    private final String name;

    DeviceType(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static DeviceType get(int code) {
        for (DeviceType t : values()) {
            if (t.code == code) {
                return t;
            }
        }
        throw new IllegalArgumentException("没有找到对应的类型！");
    }
}
